package cn.xxx.auth.controller.v1;

import org.bytesoft.compensable.Compensable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.xxx.auth.feginclient.v1.ApiAccountClient;
import cn.xxx.auth.model.entity.Account;
import cn.xxx.auth.service.IAccountService;
import io.swagger.annotations.Api;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Mybatis Plus
 * @since 2017-07-05
 */
@Api(tags = {"Account"}, description = "账号操作相关接口")
@RestController
@RequestMapping("/v1/account")
@Compensable(interfaceClass = ApiAccountClient.class, confirmableKey = "bbbServiceConfirm", cancellableKey = "bbbServiceCancel")
public class AccountRestController implements ApiAccountClient {

    @Autowired
    private IAccountService accountService;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public Account test() {
        System.out.println("执行try-----------------------------------");
        Account account = new Account();
        account.setUid(10000L);
        account.setLoginName("10000L");
        account.setStatus(0);
        account.setSourceType("P");
        accountService.insert(account);
        return account;
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public Account test1() {
        System.out.println("执行try-----------------------------------");
        Account account = new Account();
        account.setUid(10000L);
        account.setLoginName("10000L");
        account.setStatus(0);
        account.setSourceType("P");
        accountService.insert(account);
        return account;
    }


}